﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class DeclarationsBlanaceRptQuery : BasePage
    {
        protected Button btnSearch;
        protected DropDownList ddlItemNoID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSkuID;
        protected HtmlForm F15530;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected HtmlImage img1;
        protected HtmlImage img3;
        protected Label lblEndTime;
        protected Label lblItemNoID;
        protected Label lblOwnerID;
        protected Label lblSkuID;
        protected Label lblStartTime;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtEndTime;
        protected TextBox txtItemNoID;
        protected TextBox txtOwnerID;
        protected TextBox txtSkuID;
        protected TextBox txtStartTime;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DeclarationsBlanaceRptList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDDl()
        {
            this.txtStartTime.Text = base.GetPreferenceShortDate(DateTime.Now.ToString());
            this.txtEndTime.Text = base.GetPreferenceShortDate(DateTime.Now.ToString());
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlItemNoID, 0);
            base.SetDefaultOwner(this.txtOwnerID);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(base.ChangeDateType(this.txtEndTime.Text.Trim())).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "9999-12-31 23:59:59";
            }
        }

        public string ItemNoID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtItemNoID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtItemNoID.Text.Trim(), this.ddlItemNoID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(base.ChangeDateType(this.txtStartTime.Text.Trim())).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "2000-01-01 00:00:00";
            }
        }
    }
}

